﻿using Library.Linq;
using Library.Linq.Expressions;
using Library.Logic.Constraints;
using System;

namespace Library.Logic
{
    public static partial class Builtin
    {
        //public static bool Add<T>(this IConstraints<Action<T>> constraints, System.Linq.Expressions.Expression<Func<T, bool>> constraint)
        //{
        //    ParameterReplacementVisitor p = new ParameterReplacementVisitor(constraint.Parameters.ToVector(), constraints.InputParameters);
        //    return constraints.Add(((LambdaExpression)p.Visit(constraint)).Body);
        //}
        //public static bool Remove<T>(this IConstraints<Action<T>> constraints, System.Linq.Expressions.Expression<Func<T, bool>> constraint)
        //{
        //    ParameterReplacementVisitor p = new ParameterReplacementVisitor(constraint.Parameters.ToVector(), constraints.InputParameters);
        //    return constraints.Remove(((LambdaExpression)p.Visit(constraint)).Body);
        //}
        
        //public static bool Add<T>(this IConstraints<Action<T>> constraints, System.Linq.Expressions.Expression<FuncOutput<IArgument, T, bool>> constraint)
        //{
        //    ParameterReplacementVisitor p = new ParameterReplacementVisitor(constraint.Parameters.ToVector(), Library.Linq.Enumerable.Concat(constraints.ArgumentParameter, constraints.InputParameters).ToVector());
        //    return constraints.Add(((LambdaExpression)p.Visit(constraint)).Body);
        //}
        //public static bool Remove<T>(this IConstraints<Action<T>> constraints, System.Linq.Expressions.Expression<FuncOutput<IArgument, T, bool>> constraint)
        //{
        //    ParameterReplacementVisitor p = new ParameterReplacementVisitor(constraint.Parameters.ToVector(), Library.Linq.Enumerable.Concat(constraints.ArgumentParameter, constraints.InputParameters).ToVector());
        //    return constraints.Remove(((LambdaExpression)p.Visit(constraint)).Body);
        //}



        //public static IConstraints CartesianProduct(this IConstraints variable, IConstraints other)
        //{
        //    throw new NotImplementedException();
        //}

        //public static IConstraints<Action<T1, T2>> CartesianProduct<T1, T2>(this IConstraints<Action<T1>> variable, IConstraints<Action<T2>> other)
        //{
        //    throw new NotImplementedException();
        //}
        //public static IConstraints<Action<T1, T2, T3>> CartesianProduct<T1, T2, T3>(this IConstraints<Action<T1, T2>> variable, IConstraints<Action<T3>> other)
        //{
        //    throw new NotImplementedException();
        //}
        //public static IConstraints<Action<T1, T2, T3, T4>> CartesianProduct<T1, T2, T3, T4>(this IConstraints<Action<T1, T2, T3>> variable, IConstraints<Action<T4>> other)
        //{
        //    throw new NotImplementedException();
        //}



        //public static bool Contains<T>(this IHasElementConstraints<Action<T>> set, T item)
        //{
        //    return set.ElementConstraints.Validate(new object[] { item });
        //}
        //public static bool Contains<T1, T2>(this IHasElementConstraints<Action<T1, T2>> set, T1 item1, T2 item2)
        //{
        //    return set.ElementConstraints.Validate(new object[] { item1, item2 });
        //}
        //public static bool Contains<T1, T2, T3>(this IHasElementConstraints<Action<T1, T2, T3>> set, T1 item1, T2 item2, T3 item3)
        //{
        //    return set.ElementConstraints.Validate(new object[] { item1, item2, item3 });
        //}
        //public static bool Contains<T1, T2, T3, T4>(this IHasElementConstraints<Action<T1, T2, T3, T4>> set, T1 item1, T2 item2, T3 item3, T4 item4)
        //{
        //    return set.ElementConstraints.Validate(new object[] { item1, item2, item3, item4 });
        //}
    }
}
